#ifndef __PLATFORM_H
#define __PLATFORM_H

#define OUTPUT1_PORT 	LPC_GPIO1
#define OUTPUT1_PIN		(1<<28)	
#define OUTPUT2_PORT 	LPC_GPIO1
#define OUTPUT2_PIN		(1<<29)	

#define OUTPUT3_PORT 	LPC_GPIO1 //На схеме третьего выхода нет - заведем его на не подключенную ногу
#define OUTPUT3_PIN		(1<<31)	

#define OUTPUT1_HIGH (OUTPUT1_PORT->FIOPIN|=OUTPUT1_PIN)
#define OUTPUT1_LOW (OUTPUT1_PORT->FIOPIN&=~OUTPUT1_PIN)
#define OUTPUT2_HIGH (OUTPUT2_PORT->FIOPIN|=OUTPUT2_PIN)
#define OUTPUT2_LOW (OUTPUT2_PORT->FIOPIN&=~OUTPUT2_PIN)
#define OUTPUT3_HIGH (OUTPUT3_PORT->FIOPIN|=OUTPUT3_PIN)
#define OUTPUT3_LOW (OUTPUT3_PORT->FIOPIN&=~OUTPUT3_PIN)

#define INPUT0_PORT	LPC_GPIO1
#define INPUT0_PIN	(1<<20)
#define INPUT1_PORT	LPC_GPIO1
#define INPUT1_PIN	(1<<21)
#define INPUT2_PORT	LPC_GPIO1
#define INPUT2_PIN	(1<<23)
#define INPUT3_PORT	LPC_GPIO1
#define INPUT3_PIN	(1<<24)
#define INPUT4_PORT	LPC_GPIO1
#define INPUT4_PIN	(1<<25)
#define INPUT5_PORT	LPC_GPIO1
#define INPUT5_PIN	(1<<26)

#define INPUT0_READ (INPUT0_PORT->FIOPIN&INPUT0_PIN)
#define INPUT1_READ (INPUT1_PORT->FIOPIN&INPUT1_PIN)
#define INPUT2_READ (INPUT2_PORT->FIOPIN&INPUT2_PIN)
#define INPUT3_READ (INPUT3_PORT->FIOPIN&INPUT3_PIN)
#define INPUT4_READ (INPUT4_PORT->FIOPIN&INPUT4_PIN)
#define INPUT5_READ (INPUT5_PORT->FIOPIN&INPUT5_PIN)

//Cветодиоды
#define TEST_LED_PORT LPC_GPIO2
#define TEST_LED_PIN	(1<<4)

#define TEST_LED_ON  (TEST_LED_PORT->FIOPIN|=TEST_LED_PIN)
#define TEST_LED_OFF (TEST_LED_PORT->FIOPIN&=~TEST_LED_PIN)



extern void leds_init(void);
extern void outputs_init(void);
extern void inputs_init(void);
extern U8 inputs_read(U8 num);
#endif
